System.register(["@angular/http", "ng2-layer", "@angular/core", "@angular/router"], function (exports_1, context_1) {
    "use strict";
    var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata = (this && this.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
    };
    var __moduleName = context_1 && context_1.id;
    var http_1, ng2_layer_1, core_1, router_1, BindWxComp, _a;
    return {
        setters: [
            function (http_1_1) {
                http_1 = http_1_1;
            },
            function (ng2_layer_1_1) {
                ng2_layer_1 = ng2_layer_1_1;
            },
            function (core_1_1) {
                core_1 = core_1_1;
            },
            function (router_1_1) {
                router_1 = router_1_1;
            }
        ],
        execute: function () {
            BindWxComp = (function () {
                function BindWxComp(http, layer, router) {
                    var _this = this;
                    this.http = http;
                    this.layer = layer;
                    this.router = router;
                    this.bindData = {};
                    this.http.get({
                        search: {
                            m: "Admin",
                            c: "ApiWallet",
                            a: "get_user_wallet"
                        }
                    }).then(function (d) {
                        _this.bindData = d.data.info;
                        if (d.data.is == 1) {
                            _this.router.navigateByUrl('/pay');
                        }
                    });
                }
                BindWxComp.prototype.bindWx = function () {
                    var _this = this;
                    this.loading = true;
                    this.http.post({
                        search: {
                            m: "Admin",
                            c: "ApiWallet",
                            a: "bound_user_wallet"
                        },
                        body: {
                            id_card: this.bindData.id_card,
                            name: this.bindData.name
                        }
                    }).then(function (data) {
                        _this.loading = false;
                        if (data.code == 200) {
                            _this.router.navigateByUrl('/pay');
                        }
                    });
                };
                BindWxComp.prototype.openWechat = function () {
                    var top = (screen.height - 520) / 2, left = (screen.width - 400) / 2;
                    var win = window.open('https://open.weixin.qq.com/connect/qrconnect?appid=wx2fa04ec2138ba0ca&redirect_uri=http%3A%2F%2Fapi.txiaoyuan.cn%2Findex%2Ft.php%3Fm%3DAdmin%26c%3DWx%26a%3Dbind_wallet_code&response_type=code&scope=snsapi_login&state=3d6be0a4035d839573b04816624a415e#wechat_redirect', '', "width=400,scrolling=no,height=520,resizable=0,top=150,left=$left".replace("$left", left));
                    setInterval(function () {
                        win.postMessage('http://192.168.56.1:8020/', 'http://api.txiaoyuan.cn/');
                    }, 1000);
                    window.addEventListener('message', function (e) {
                        console.log(e);
                    }, false);
                };
                return BindWxComp;
            }());
            BindWxComp = __decorate([
                core_1.Component({
                    selector: '.category',
                    templateUrl: 'template/router/pay/bindWx.html'
                }),
                __metadata("design:paramtypes", [http_1.Http, typeof (_a = typeof ng2_layer_1.NgLayer !== "undefined" && ng2_layer_1.NgLayer) === "function" && _a || Object, router_1.Router])
            ], BindWxComp);
            exports_1("BindWxComp", BindWxComp);
        }
    };
});
